package com.netease.nie.dao;

import java.util.List;

import javax.annotation.Resource;

import org.springframework.stereotype.Repository;

import com.netease.nie.constants.PublishedConstants;
import com.netease.nie.mapper.RobGoodsInfoPeriodMapper;
import com.netease.nie.model.RobGoodsInfoPeriod;

@Repository
public class RobGoodsInfoPeriodDao {

	@Resource
	private RobGoodsInfoPeriodMapper robGoodsInfoPeriodMapper;
	
	public List<RobGoodsInfoPeriod> queryMaxPeriodRobGoodsInfoPeriodsByRobGoodsIds(List<Integer> robGoodsIds) {
		return robGoodsInfoPeriodMapper.queryMaxPeriodRobGoodsInfoPeriodsByRobGoodsIds(robGoodsIds);
	}
	
	public List<RobGoodsInfoPeriod> queryRobGoodsInfoPublishedPeriodsByRobGoodsId(int robGoodsId) {
		return robGoodsInfoPeriodMapper.queryRobGoodsInfoPublishedPeriodsByRobGoodsId(robGoodsId);
	}
	
	public RobGoodsInfoPeriod queryRobGoodsInfoPeriodByDisplayPeriod(int displayPeriod) {
		return robGoodsInfoPeriodMapper.queryRobGoodsInfoPeriodByDisplayPeriod(displayPeriod);
	}
	
	public int updateRobGoodsPeriod(RobGoodsInfoPeriod robGoodsInfoPeriod) throws Exception {
		return robGoodsInfoPeriodMapper.updateRobGoodsPeriod(robGoodsInfoPeriod);
	}
	
	public List<RobGoodsInfoPeriod> queryUserRobGoodsInfoPeriodsByUserId(long userId, PublishedConstants publishedConstants, int pageIndex, int pageSize) {
		return robGoodsInfoPeriodMapper.queryUserRobGoodsInfoPeriodsByUserIdAndPublished(userId, publishedConstants.getCode(), pageIndex, pageSize);
	}
	
	public List<RobGoodsInfoPeriod> queryUserRobGoodsInfoPeriodsByUserId(long userId, int pageIndex, int pageSize) {
		return robGoodsInfoPeriodMapper.queryUserRobGoodsInfoPeriodsByUserId(userId, pageIndex, pageSize);
	}
}
